#include <stdio.h>
#include <unistd.h>

void show_progress(int progress) {
    const char *spinner = "-\\|/";
    printf("\r[");
    int bar_width = 50;
    int pos = bar_width * progress / 100;
    for (int i = 0; i < bar_width; ++i) {
        if (i < pos) {
            printf("=");
        } else if (i == pos) {
            printf(">");
        } else {
            printf(" ");
        }
    }
    printf("] %d%% %c", progress, spinner[progress % 4]);
    fflush(stdout);
}

int main() {
    for (int i = 0; i <= 100; ++i) {
        show_progress(i);
        usleep(100000);
    }
    printf("\n");
    return 0;
}

